﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CMP.ERP.Model;
using CMP.ERP.BLL;
using System.Data;

namespace CMP.ERP.Admin.Controllers
{
    public class PandiandanController : Controller
    {
        //
        // GET: /Pandiandan/
        PandiandanBLL bll = new PandiandanBLL();
        /// <summary>
        /// 显示数据信息
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            List<PandianList> list = new List<PandianList>();
            DataTable data = bll.GetPandianList();
            foreach (DataRow item in data.Rows)
            {
                PandianList p = new PandianList();
                
                p.PandianId = Convert.ToInt32(item["PandianId"]);
                p.ShangpinName = item["ShangpinName"].ToString();
                p.CangkuName = item["CangkuName"].ToString();
                p.PandianqianNum = Convert.ToInt32(item["PandianqianNum"]);
                p.PandianhouNum = Convert.ToInt32(item["PandianhouNum"]);
                p.BeiZhu = item["BeiZhu"].ToString();
                list.Add(p);
            }
            return View(list);
        }
        public ActionResult Del(string id)
        {
            string[] str = id.Split(',');
            for(int i =0;i<str.Length;i++)
            {
                int qid = Convert.ToInt32(str[i]);
                bll.Del(qid);
            }
            return Json(true,JsonRequestBehavior.AllowGet);
        }

    }
}
